package com.bmd.backgroundmanger.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bmd.backgroundmanger.entity.Notification;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 通知Mapper接口
 */
@Mapper
public interface NotificationMapper extends BaseMapper<Notification> {

    /**
     * 根据用户ID查询未读通知
     */
    @Select("SELECT * FROM notifications WHERE user_id = #{userId} AND read_status = 0 ORDER BY send_time DESC")
    List<Notification> selectUnreadByUserId(Integer userId);

    /**
     * 根据用户ID查询所有通知
     */
    @Select("SELECT * FROM notifications WHERE user_id = #{userId} ORDER BY send_time DESC")
    List<Notification> selectByUserId(Integer userId);
} 